(function(){
	angular.module("webApp").controller("UserCtrl",UserCtrl);
	
	UserCtrl.$inject=['$scope','dataService','$rootScope','$timeout','$state']
	function UserCtrl($scope,dataService,$rootScope,$timeout,$state){
		var popup=null;
		$scope.getUser=function(){
			if(!popup){
	   	    	popup = new auiPopup();
			}
			console.log(popup);
			dataService.shopUserCurrentGet().then(function(user){
				console.log(user);
				$scope.user=user;
			});
	
		}
  
		$scope.popupshow=function(){
				console.log($('#user-top-left').css("display"));
				if($('#user-top-left').css("display")=='none'){
			console.log("1111111111111111111111111111111");

			 		popup.show(document.getElementById("user-top-left"))
				}
		}
		$scope.logout=function(){
			popup.hide(document.getElementById("user-top-left"));
			$timeout(function(){
				$rootScope.logout();
			},300)
		}
		$scope.popupClose=function(){
			console.log(popup,22222,$('#user-top-left').css("display"));
			if($('#user-top-left').css("display")=='block'){
				popup.hide(document.getElementById("user-top-left"));
			}
		}
		$scope.goAddress=function(){
			$timeout(function() {
				$state.go("address.list");
			}, 310);
		}
	}
})();